package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution1448 {
    public int goodNodes(TreeNode root) {
        return TreeUtils.goodNodes(root);
    }
}

public class leetcode1448 {
    public static void main(String[] args) {
        Solution1448 solution1448 = new Solution1448();
        Integer[] nums = {3, 1, 4, 3, null, 1, 5};
        Integer[] nums1 = {3, 3, null, 4, 2};
        Integer[] nums2 = {1};
        System.out.println(solution1448.goodNodes(TreeUtils.generateLeetcodeTree(nums)));
        System.out.println(solution1448.goodNodes(TreeUtils.generateLeetcodeTree(nums1)));
        System.out.println(solution1448.goodNodes(TreeUtils.generateLeetcodeTree(nums2)));
    }
}
